#ifndef RESULT_H
#define RESULT_H

#include "any.hpp"
#include "Semophore.hpp"
#include <memory>
#include "Task.hpp"
class Task;
class Result
{
public:
	Result(std::shared_ptr<Task> task, bool isValid=true);
	~Result() = default;
	//get the result
	Any get();
	//set the result
	void set(Any any);
private:
	Any any_;//store the result
	Semophore semo_;//semophore associated with the result
	std::shared_ptr<Task> task_;
	std::atomic_bool isValid_;//if the isValid is true,the result should wait for the semo_
};
#endif